package cz.wql.dao;

import cz.wql.domain.Customer;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface CustomerMapper extends Mapper<Customer>{


// 查询客户全部信息 包括信息来源和客户级别 信息
    //多对一  多个客户可能属于同一个来源
    @Select("select * from  cst_customer ")
    @Results({
            @Result(property = "custSource",column = "cust_source"),
            @Result(property = "custLevelBaseDict", one = @One(select = "cz.wql.dao.BaseDictMapper.findcustLevelBaseDict"), column = "cust_level"),
            @Result(property = "custSourceBaseDict", one = @One(select = "cz.wql.dao.BaseDictMapper.findcustSourceBaseDict"), column = "cust_source"),
    }
    )
     public List<Customer>findCustomerlist();



@Select("select * from cst_customer where cust_id=#{custId}")
    public Customer findcustomerName(Long custId);


}
